package com.yytek.nmp.service.impl;

import java.util.List;
import com.yytek.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yytek.nmp.mapper.IotServiceHistoryMapper;
import com.yytek.nmp.domain.IotServiceHistory;
import com.yytek.nmp.service.IIotServiceHistoryService;

/**
 * 服务记录Service业务层处理
 * 
 * @author yytek-iot
 * @date 2022-07-13
 */
@Service
public class IotServiceHistoryServiceImpl implements IIotServiceHistoryService 
{
    @Autowired
    private IotServiceHistoryMapper iotServiceHistoryMapper;

    /**
     * 查询服务记录
     * 
     * @param id 服务记录主键
     * @return 服务记录
     */
    @Override
    public IotServiceHistory selectIotServiceHistoryById(Long id)
    {
        return iotServiceHistoryMapper.selectIotServiceHistoryById(id);
    }

    /**
     * 查询服务记录列表
     * 
     * @param iotServiceHistory 服务记录
     * @return 服务记录
     */
    @Override
    public List<IotServiceHistory> selectIotServiceHistoryList(IotServiceHistory iotServiceHistory)
    {
        return iotServiceHistoryMapper.selectIotServiceHistoryList(iotServiceHistory);
    }

    /**
     * 新增服务记录
     * 
     * @param iotServiceHistory 服务记录
     * @return 结果
     */
    @Override
    public int insertIotServiceHistory(IotServiceHistory iotServiceHistory)
    {
        iotServiceHistory.setCreateTime(DateUtils.getNowDate());
        return iotServiceHistoryMapper.insertIotServiceHistory(iotServiceHistory);
    }

    /**
     * 修改服务记录
     * 
     * @param iotServiceHistory 服务记录
     * @return 结果
     */
    @Override
    public int updateIotServiceHistory(IotServiceHistory iotServiceHistory)
    {
        iotServiceHistory.setUpdateTime(DateUtils.getNowDate());
        return iotServiceHistoryMapper.updateIotServiceHistory(iotServiceHistory);
    }

    /**
     * 批量删除服务记录
     * 
     * @param ids 需要删除的服务记录主键
     * @return 结果
     */
    @Override
    public int deleteIotServiceHistoryByIds(Long[] ids)
    {
        return iotServiceHistoryMapper.deleteIotServiceHistoryByIds(ids);
    }

    /**
     * 删除服务记录信息
     * 
     * @param id 服务记录主键
     * @return 结果
     */
    @Override
    public int deleteIotServiceHistoryById(Long id)
    {
        return iotServiceHistoryMapper.deleteIotServiceHistoryById(id);
    }
}
